//
//  FourthViewController.m
//  StreamVideoDemo
//
//  Created by DaveLam on 15/1/21.
//  Copyright (c) 2015年 DaveLam. All rights reserved.
//

#import "RankViewController.h"
//#import "KxMovieViewController.h"

@interface RankViewController ()

@end

@implementation RankViewController
- (id) init{
    self=[super init];
    self.isPlaying=false;
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.moviePlayer=[[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://159.226.113.170/streams/7/a8ff0b156fd948c4a5e762e5391b8c67.mp4"]];
    [[self view]addSubview:[self.moviePlayer view]];
    int height=[self.view bounds].size.height/2;
    int width=[self.view bounds].size.width;
    [[self.moviePlayer view]setFrame:CGRectMake(0, 200, width, height)];
    //UIViewController *vc;
    //vc = [KxMovieViewController movieViewControllerWithContentPath:nil parameters:nil];
    //[self presentViewController:vc animated:YES completion:nil];
}
- (IBAction)play:(id)sender {
    NSLog(@"press the play button");
    if(!self.isPlaying){
        [self.moviePlayer play];
        self.isPlaying=true;
        [self.play_btn setTitle:@"暂停" forState:UIControlStateNormal];
    }
    else{
        self.isPlaying=false;
        [self.moviePlayer stop];
        [self.play_btn setTitle:@"播放" forState:UIControlStateNormal];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
